<template>
  <div class="home">
    <el-container>
      <el-header>
        <div class="home_header_container">
          <div>UNI-ADMIN</div>
          <div>
            <el-menu :default-active="activeIndex" 
            class="el-menu-demo" 
            mode="horizontal" 
            background-color="#545c64"
            text-color="#fff"
            active-text-color="#ffd04b"
            @select="handleSelect">
              <el-menu-item index="1">首页</el-menu-item>
              <el-menu-item index="2">商品</el-menu-item>
              <el-menu-item index="3">订单</el-menu-item>
              <el-menu-item index="4">会员</el-menu-item>
              <el-menu-item index="5">设置</el-menu-item>
            </el-menu>
          </div>
        </div>
      </el-header>
      <router-view></router-view>
    </el-container>
  </div>
</template>

<script>
// @ is an alias to /src

export default {
  name: 'Home',
  components: {
    
  },
  data(){
    return{
      activeIndex:"1"
    }
  },
  methods:{
    handleSelect(key, keyPath){
      console.log(key, keyPath);
      this.activeIndex = key;
      var path = "";
      switch (key){
        case "1":
          path="/";
          break;
        case "2":
          path="/store";
          break;
        case "3":
          path="/order";
          break;
        case "4":
          path="/member";
          break;
        case "5":
          path="/setting";
          break;
        default:
          break;
      }
      this.$router.push(path)
    }
  }
}
</script>

<style scoped>
 .el-header, .el-footer {
    background-color:rgb(82, 93, 100);
    color: white;
    height: 60px;
  }
  
  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    height: 100vh;
  }
  
  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    line-height: 160px;
  }
  
  body > .el-container {
    margin-bottom: 40px;
  }
  
  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }
  
  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
  .home_header_container
  {
    width: 100%;
    height: 60px;
    display: inline-flex;
    justify-content: space-between;
    align-items: center;
  }

.el-menu-demo
{
  background-color:rgb(82, 93, 100);
}

</style>
